package me.a01myfunction;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

public class FunctionDemo4 {
    public static void main(String[] args) {
        //需求：集合中存储字符串的数据
        //收集到Student类型的数组中
        ArrayList<String> list = new ArrayList<>();
        Collections.addAll(list, "张无忌,15", "周芷若,14", "赵敏,13", "张强,20",
                "张三丰,100", "张翠山,40", "张良,35", "王二麻子,37", "谢广坤,41");
        //可以先把数据变成Student对象，再收集起来
        Student[] arr = list.stream().map(Student::new).toArray(Student[]::new);
        //打印数据
        System.out.println(Arrays.toString(arr));
    }
}
